package cn.vivi.design.command;

import java.util.ArrayList;
import java.util.List;

/**
 * 服务员类
 */
public class Waiter {

    /**
     * 持有多个命令对象
     */
    private List<Command> commands = new ArrayList<>();

    public void setCommand(Command command) {
        commands.add(command);
    }

    // 发起命令
    public void orderUp() {
        System.out.println("厨师，订单来了");
        for (Command command : commands) {
            command.execute();
        }
    }
}
